package com.example.demo.controller;

import com.example.demo.annotation.Roles;
import com.example.demo.dto.ElderlyBasicAddDTO;
import com.example.demo.dto.PageDTO;
import com.example.demo.pojo.ElderlyBasic;
import com.example.demo.pojo.Result;
import com.example.demo.service.ElderlyBasicService;
import com.example.demo.vo.ElderlyVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("elderly")
@Slf4j
@Tag(name = "老人接口")
@RequiredArgsConstructor
public class ElderlyBasicController {
    private final ElderlyBasicService elderlyBasicInfoService;
    @PostMapping
    @Operation(summary = "添加未确认数据")
    @Roles(values = "ru")
    public Result addElderlyBasic(@RequestBody ElderlyBasicAddDTO elderlyBasicAddDTO) {
        elderlyBasicInfoService.addElderlyBasic(elderlyBasicAddDTO);
        return Result.success();
    }
    @GetMapping
    @Operation(summary = "查看未确认数据")
    @Roles(values = "da")
    public Result<List<ElderlyBasic>> getElderly(PageDTO pageDTO) {
        List<ElderlyBasic> elderlyVOList = elderlyBasicInfoService.getElderly(pageDTO);
        return Result.success(elderlyVOList);
    }
}
